<template>
  <div class="home">
    <img alt="Vue logo" src="../assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <button @click="goAbout">点击About</button>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";

export default {
  name: "Home",
  components: {
    HelloWorld
  },
  mounted: function() {
    console.log("mounted");
    const request = new XMLHttpRequest();
    request.open("get", "./api/app");
    request.addEventListener("readystatechange", function() {});
    request.send();
  },
  methods: {
    goAbout: function() {
      this.$router.push({ name: "About", params: { ab: 1 } });
    }
  }
};
</script>
